#version 320 es

precision highp float;

struct ParticleStructure
{
    vec4 pos;
    vec4 vec;
};

layout (local_size_x = 320) in;

layout (std140, binding = 0) buffer ParticleBuffer {
    ParticleStructure Particle[];
};

layout(location = 1) uniform float timestep;

void main()
{
    uint index = gl_GlobalInvocationID.x;
    vec3 position = Particle[index].pos.xyz;
    vec3 velocity = Particle[index].vec.xyz;

    velocity += vec3(0.0, -0.2, 0.0) * timestep;
    position += velocity * timestep;
    Particle[index].pos = vec4(position, 1.0f);
    Particle[index].vec = vec4(velocity, 1.0f);
}